<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id ='i1' onfocus="Focus();" onblur="Blur()" value="请输入关键字">
<input type="text" placeholder="请输入关键字">
<script>
    function Focus() {
        var t=document.getElementById('i1');
        var t_value = t.value;
        if(t_value == "请输入关键字"){
            t.value="";
        }
    }
    function Blur() {
        var t=document.getElementById('i1');
        var t_value = t.value;
        if(t_value.length ==0){
            t.value="请输入关键字"
        }
    }
</script>
</body>
</html>